// Copyright  2004-2008 Backplane Ltd.
//
// This file is part of Ubiquity formsPlayer
//
// Ubiquity formsPlayer is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
//
// Ubiquity formsPlayer is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License
// along with Ubiquity formsPlayer If not, see <http://www.gnu.org/licenses/>.
//	
//
//   Purpose: declaration of CEvaluator.
//   $Id$
// Evaluator.h : Declaration of the CEvaluator

#pragma once
#include "resource.h"       // main symbols

#include "XForms.h"
#include <DOM3XPath.h>

class CImplContent;
// CEvaluator

class ATL_NO_VTABLE CEvaluator : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CEvaluator, &CLSID_Evaluator>,
	public IDispatchImpl<IEvaluator, &IID_IEvaluator, &LIBID_XFORMSLib, /*wMajor =*/ 1, /*wMinor =*/ 16>,
	public IDispatchImpl<IXPathEvaluator, &__uuidof(IXPathEvaluator), &LIBID_DOM3XPATHLib, /* wMajor = */ 1, /* wMinor = */ 1>
{
public:
	CEvaluator()
		:m_pContent(0)
	{
	}

	DECLARE_REGISTRY_RESOURCEID(IDR_EVALUATOR)


	BEGIN_COM_MAP(CEvaluator)
		COM_INTERFACE_ENTRY(IEvaluator)
		COM_INTERFACE_ENTRY2(IDispatch, IXPathEvaluator)
		COM_INTERFACE_ENTRY(IXPathEvaluator)
	END_COM_MAP()


	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		return S_OK;
	}

	void FinalRelease() 
	{
	}

	void init(CImplContent * pContent);

	// IXPathEvaluator Methods
	STDMETHOD(createExpression)(BSTR /*expression*/, IXPathNSResolver * /*resolver*/, IXPathExpression ** /*retVal*/)
	{
		return E_NOTIMPL;
	}
	STDMETHOD(createNSResolver)(IXMLDOMNode * /*nodeResolver*/, IXPathNSResolver ** /*retVal*/)
	{
		return E_NOTIMPL;
	}
	STDMETHOD(evaluate)(BSTR expression, IXMLDOMNode * contextNode, IXPathNSResolver * resolver, short type, IXPathResult * result, IXPathResult * * retVal);
private:
	CImplContent * m_pContent;
};

OBJECT_ENTRY_AUTO(__uuidof(Evaluator), CEvaluator)
